// Copyright 2012 dmitry.a.novikov@gmail.com
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "consistenz.h"
#include "exception.h"
#include "objectimpl.h"

namespace CnsZ {

  P<Object> Exception::message() const {
    return msg;
  }

  CNSZ_DEFINE_STATIC_STRING(msgGenericException,L"Generic exception.");
  Exception::Exception() : msg(CNSZ_GET_STATIC_STRING(msgGenericException)) {}

  CNSZ_DEFINE_STATIC_STRING(msgNotApplicable,L"Not applicable.");
  NotApplicable::NotApplicable() : Exception(CNSZ_GET_STATIC_STRING(msgNotApplicable)) {}

  CNSZ_DEFINE_STATIC_STRING(msgNullFactory,L"Null factory.");
  NullFactory::NullFactory() : Exception(CNSZ_GET_STATIC_STRING(msgNullFactory)) {}

  CNSZ_DEFINE_STATIC_STRING(msgInvalidArg,L"Invalid argument.");
  InvalidArg::InvalidArg() : Exception(CNSZ_GET_STATIC_STRING(msgInvalidArg)) {}

  CNSZ_DEFINE_STATIC_STRING(msgInvalidCast,L"Invalid cast.");
  InvalidCast::InvalidCast() : Exception(CNSZ_GET_STATIC_STRING(msgInvalidCast)) {}

  CNSZ_DEFINE_STATIC_STRING(msgNullPointer,L"Null pointer.");
  NullPointer::NullPointer() : Exception(CNSZ_GET_STATIC_STRING(msgNullPointer)) {}

  CNSZ_DEFINE_STATIC_STRING(msgIndexOutOfBounds,L"Index out of bounds.");
  IndexOutOfBounds::IndexOutOfBounds() : Exception(CNSZ_GET_STATIC_STRING(msgIndexOutOfBounds)) {}

}//namespace CnsZ
